import React, {Component} from 'react';
import {Text,StyleSheet,TouchableOpacity,View} from 'react-native';
import {scaleSize} from '../../../utils/screen';
import FontText from '../FontText'

export default class RadioItem extends Component {
    render() {
        let {btnText,isActive,style,color} = this.props;
        if (color === undefined) {
            color = "#fd265d";
        }

        return (
            <TouchableOpacity
                activeOpacity = {0.8}
                onPress = {()=>this.onPress()}
                style = {[styles.box,{backgroundColor: isActive?color:"rgba(0,0,0,0)"},style]}
                >
                <FontText font={'book'} style = {[styles.btnText,{color:isActive?"#fff":color}]}>{btnText}</FontText>
            </TouchableOpacity>
        );
    }
    onPress(){
        let {onPress} = this.props;
        onPress && onPress(this);
    }
}

const styles = StyleSheet.create({
    box:{
        justifyContent: 'center',
        alignItems: 'center',
        height:scaleSize(50),
        paddingHorizontal: scaleSize(80),
    },
    btnText:{
        color:"#fd265d",
        fontSize: scaleSize(27),
    }
})
